public class Runner {
	private static OptimizedFunction function = new Parabola(2, 0.1);
	private static int fireflies = 10;
	private static double absorption = 1.0;
	private static double randomness = 1.1;
	private static double attractiveness = 1.0;
	private static int iterations = 10000;
	private static boolean showAll = false;
	
	public static void main(String[] args) {
		FireflySet set = new FireflySet(function, fireflies, absorption,
				randomness, attractiveness);
		set.initPositions();
		System.out.println("Poczatkowa konfiguracja:");
		for (double[] position : set.getPositions()) {
			for (double x : position)
				System.out.print(String.valueOf(x) + " ");
			System.out.println();
		}
		System.out.println();
		for (int i = 0; i < iterations; i++) {
			set.iteration();
			if (showAll) {
				System.out.println("Iteracja skonczona. Stan:");
				for (double[] position : set.getPositions()) {
					for (double x : position)
						System.out.print(String.valueOf(x) + " ");
					System.out.println();
				}
				System.out.print("Najlepszy: ");
			}
			System.out.print(String.valueOf(set.getBest()) + " ");
			for (double x : set.getBestPosition())
				System.out.print(String.valueOf(x) + " ");
			System.out.println();
			if (showAll)
				System.out.println();
		}
	}
}
